package com.live.video.controller;

import com.live.video.model.GiftPlan;
import com.live.video.server.GiftServer;
import com.live.video.util.Result;
import com.live.video.util.ResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:
 * User: godd
 * Date: 2017-11-05
 * Time: 18:00
 */
@RestController
@Slf4j
@RequestMapping("gift")
public class GiftController {

    @Autowired
    private GiftServer giftServer;

    @RequestMapping("/add")
    Result putGift(GiftPlan giftPlan) {
        giftServer.save(giftPlan);
        return ResultUtil.success();
    }

    @RequestMapping("/query")
    Result putGift() {
        List<GiftPlan> giftplans = giftServer.queryAll();
        return ResultUtil.success(giftplans);
    }
}
